package com.erp.pro.service.impl;

import com.erp.common.service.DictService;
import com.erp.oa.domain.NotifyDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.erp.pro.dao.WarehouseDao;
import com.erp.pro.domain.WarehouseDO;
import com.erp.pro.service.WarehouseService;



@Service
public class WarehouseServiceImpl implements WarehouseService {
	@Autowired
	private WarehouseDao warehouseDao;

	@Autowired
	private DictService dictService;

	
	@Override
	public WarehouseDO get(Long id){
		return warehouseDao.get(id);
	}
	
	@Override
	public List<WarehouseDO> list(Map<String, Object> map){
		List<WarehouseDO> warehouseDOList =  warehouseDao.list(map);
		for (WarehouseDO warehouseDO : warehouseDOList) {
			warehouseDO.setTags(dictService.getName("pro_warehouse_type", warehouseDO.getTags()));
		}
		return warehouseDOList;
	}
	
	@Override
	public int count(Map<String, Object> map){
		return warehouseDao.count(map);
	}
	
	@Override
	public int save(WarehouseDO warehouse){
		return warehouseDao.save(warehouse);
	}
	
	@Override
	public int update(WarehouseDO warehouse){
		return warehouseDao.update(warehouse);
	}
	
	@Override
	public int remove(Long id){
		return warehouseDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return warehouseDao.batchRemove(ids);
	}

	@Override
	public WarehouseDO findByName(String name) {
		return warehouseDao.findByName(name);
	}

}
